package com.sixth.controller;

import com.sixth.entity.BottomArticle;
import com.sixth.entity.Head;
import com.sixth.entity.Subject;
import com.sixth.entity.TableResult;
import com.sixth.service.BottomArticleService;
import com.sixth.until.CommonResult;
import org.checkerframework.common.subtyping.qual.Bottom;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @program: self-tui-education
 * @description:
 * @author: C
 * @create: 2022-04-23 19:23
 **/
@RestController
@RequestMapping("/home/bottomarticle")
public class BottomArticleController {
    @Autowired
    private BottomArticleService bottomArticleService;
    //底部文章查询功能
    @PostMapping("/getAllBottomArticle/{currentPage}/{pageSize}")
    private TableResult selectAllTeacher(@PathVariable Integer currentPage, @PathVariable Integer pageSize, @RequestBody BottomArticle bottomArticle) {
        return bottomArticleService.selectAllArticle(currentPage,pageSize,bottomArticle);
    }
    //底部文章修添加方法
    @PostMapping("/addBottomArticle")
    public CommonResult editRole(@RequestBody BottomArticle bottomArticle){
            System.out.println(bottomArticle);
            return bottomArticleService.addBottomArticle(bottomArticle);
        }
    //修改
    @PostMapping("/editBottomArticle")
    public CommonResult UpdateBottomArticle(@RequestBody BottomArticle bottomArticle){
        return bottomArticleService.UpdateBottom(bottomArticle);
    }
    //底部文章删除功能
    @PostMapping("/deleteBottomArticle")
    public CommonResult delete(@RequestBody BottomArticle bottomArticle) {
        return bottomArticleService.deleteFindById(bottomArticle);
    }

    //底部文章修改状态
    @PostMapping("/changeStatus/{id}/{isDisable}")
        public CommonResult changeStatus(@PathVariable String id, @PathVariable Integer isDisable) {
            return bottomArticleService.changeStatus(id,isDisable);
        }
}
